<?php

const PAY_WEIXIN = 1;   // 微信支付
const PAY_ALIPAY = 2;   // 支付宝支付

// 资金变动类型
const BALANCE_WITHDRAW_APPLY    = 1;  // 提现申请
const BALANCE_WITHDRAW_CANCEL   = 2;  // 撤销提现申请
const BALANCE_WITHDRAW_REJECT   = 3;  // 提现申请被拒绝
const BALANCE_MOBILE_PROFIT     = 4;  // 话费佣金
const BALANCE_MOBILE_RECHARGE   = 5;  // 话费扣款
const BALANCE_AGENT_RECHARGE    = 6;  // 后台充值
const BALANCE_MOBILE_REFUND     = 7;  // 充值失败退款
const BALANCE_ONLINE_RECHARGE   = 8;  // 代理商在线充值
const BALANCE_OIL_COMMISS       = 9;  // 加油佣金
const BALANCE_COUPON_COMMISS    = 10; // 权益佣金
const BALANCE_FILM_COMMISS      = 11; // 影票佣金
const BALANCE_COUPON_EXPENSE    = 12; // 权益扣费
const BALANCE_FILM_EXPENSE      = 13; // 影票扣费
const BALANCE_AGENT_REFUND      = 14; // 预付退款
const BALANCE_OIL_EXPENSE       = 15; // 加油扣费 == 暂时没有加油目前是返佣
const BALANCE_OILCARD_EXPENSE   = 16; // 油卡扣费
const BALANCE_POWER_EXPENSE     = 17; // 电费扣费
const BALANCE_OILCARD_COMMISS   = 18; // 油卡返佣
const BALANCE_POWER_COMMISS     = 19; // 电费返佣
// const BALANCE_WITHDRAW_FINISH   = 20; // 佣金提现          没用
// const BALANCE_WITHDRAW_ACCEPT   = 21; // 佣金提现申请通过   没用
const BALANCE_REFUND_APPLY      = 22; // 退款申请
const BALANCE_REFUND_CANCEL     = 23; // 退款申请撤销
const BALANCE_REFUND_REJECT     = 24; // 退款申请拒绝
// const BALANCE_REFUND_ACCEPT     = 25; // 退款申请通过       没用
// const BALANCE_REFUND_FINISH     = 26; // 退款完成           没用
// const BALANCE_REFUND_FAIL       = 27; // 退款失败           没用
// const BALANCE_WITHDRAW_FAIL     = 28; // 提现失败           没用
const BALANCE_OILCARD_REFUND    = 29; // 加油卡退款
const BALANCE_POWER_REFUND      = 30; // 电费退款
const BALANCE_COUPON_REFUND     = 31; // 权益退款
const BALANCE_FILM_REFUND       = 32; // 影票退款
const BALANCE_CHANGE_APPLY = 33; // 代理商加款申请【扣减】
const BALANCE_TRAVEL_OIL_COMMISS = 34; // 出行/加油佣金
const BALANCE_AROUND_COMMISS = 35; // 周边游佣金
const BALANCE_FOOD_COMMISS = 36; // 连锁餐饮佣金
const BALANCE_MEITUAN_SEACKILL_COMMISS = 37; // 美团秒杀佣金
const BALANCE_TACKOUT = 38;//美团外卖佣金
const BALANCE_TACKOUT_ELE = 39;//饿了么外卖佣金
const BALANCE_TACKOUT_MEITUAN_DAODIAN = 40;//美团到店
const BALANCE_MOBILE_CPS_SERV = 41;//京喜话费

const BALANCE_SUPPLIER_FIAL_GOBACK = 100;  //已结算的，供应商状态又失效了，倒扣代理商的金额 docs/已结算订单供应商失效处理方案.md


//prepaid_debit         预付扣款
//recharge_record       充值记录
//commission_details    佣金明细
//embody_record         提现记录
const BALANCE_TYPES = [
    BALANCE_WITHDRAW_APPLY           => ['name' => '提现申请','serv_type' => 0, 'embody_record'=> 1],
    BALANCE_WITHDRAW_CANCEL          => ['name' => '撤销提现申请','serv_type' => 0, 'embody_record'=> 1],
    BALANCE_WITHDRAW_REJECT          => ['name' => '提现申请被拒绝','serv_type' => 0, 'embody_record'=> 1],
    BALANCE_MOBILE_PROFIT            => ['name' => '话费佣金','serv_type' => 1, 'commission_details'=>1],
    BALANCE_MOBILE_RECHARGE          => ['name' => '话费扣款','serv_type' => 1, 'prepaid_debit' => 1],
    BALANCE_AGENT_RECHARGE           => ['name' => '后台充值','serv_type' => 0, 'recharge_record'=>1],
    BALANCE_MOBILE_REFUND            => ['name' => '话费充值失败退款','serv_type' => 1, 'prepaid_debit' => 1],
    BALANCE_ONLINE_RECHARGE          => ['name' => '代理商在线充值','serv_type' => 0, 'recharge_record'=>1],
    BALANCE_OIL_COMMISS              => ['name' => '加油佣金','serv_type' => 2, 'commission_details'=>1],
    BALANCE_COUPON_COMMISS           => ['name' => '权益佣金','serv_type' => 3, 'commission_details'=>1],
    BALANCE_FILM_COMMISS             => ['name' => '影票佣金','serv_type' => 5, 'commission_details'=>1],
    BALANCE_COUPON_EXPENSE           => ['name' => '权益扣款','serv_type' => 3, 'prepaid_debit' => 1],
    BALANCE_FILM_EXPENSE             => ['name' => '影票扣款','serv_type' => 5, 'prepaid_debit' => 1],
    BALANCE_AGENT_REFUND             => ['name' => '预付退款','serv_type' => 0],
    BALANCE_OIL_EXPENSE              => ['name' => '加油扣费','serv_type' => 0], // 加油扣费 =>=> 暂时没有加油目前是返佣
    BALANCE_OILCARD_EXPENSE          => ['name' => '油卡扣费','serv_type' => 7,  'prepaid_debit' => 1],
    BALANCE_POWER_EXPENSE            => ['name' => '电费扣费','serv_type' => 8, 'prepaid_debit' => 1],
    BALANCE_OILCARD_COMMISS          => ['name' => '油卡佣金','serv_type' => 7, 'commission_details'=>1],
    BALANCE_POWER_COMMISS            => ['name' => '电费佣金','serv_type' => 8, 'commission_details'=>1],
    BALANCE_REFUND_APPLY             => ['name' => '退款申请','serv_type' => 0, 'recharge_record'=>1],
    BALANCE_REFUND_CANCEL            => ['name' => '退款申请撤销','serv_type' => 0, 'recharge_record'=>1],
    BALANCE_REFUND_REJECT            => ['name' => '退款申请拒绝','serv_type' => 0, 'recharge_record'=>1],
    BALANCE_OILCARD_REFUND           => ['name' => '加油卡退款','serv_type' => 7,  'prepaid_debit' => 1],
    BALANCE_POWER_REFUND             => ['name' => '电费退款','serv_type' => 8, 'prepaid_debit' => 1],
    BALANCE_COUPON_REFUND            => ['name' => '权益退款','serv_type' => 3, 'prepaid_debit' => 1],
    BALANCE_FILM_REFUND              => ['name' => '影票退款','serv_type' => 5, 'prepaid_debit' => 1],
    BALANCE_CHANGE_APPLY             => ['name' => '代理商加款申请','serv_type' => 0, 'recharge_record'=>1],
    BALANCE_TRAVEL_OIL_COMMISS       => ['name' => '出行/加油CPS佣金','serv_type' => 9, 'commission_details'=>1],
    BALANCE_AROUND_COMMISS           => ['name' => '周边游CPS佣金','serv_type' => 10, 'commission_details'=>1],
    BALANCE_FOOD_COMMISS             => ['name' => '连锁餐饮CPS佣金','serv_type' => 11, 'commission_details'=>1],
    BALANCE_MEITUAN_SEACKILL_COMMISS => ['name' => '美团秒杀CPS佣金','serv_type' => 12, 'commission_details'=>1],
    BALANCE_TACKOUT                  => ['name' => '美团外卖佣金','serv_type' => 14,'commission_details'=>1],
    BALANCE_TACKOUT_ELE              => ['name' => '饿了么外卖佣金','serv_type' => 13, 'commission_details'=>1],
    BALANCE_TACKOUT_MEITUAN_DAODIAN  => ['name' => '美团到店佣金','serv_type' => 6, 'commission_details'=>1],
    BALANCE_MOBILE_CPS_SERV          => ['name' => 'CPS话费佣金','serv_type' => 15,  'commission_details'=>1],
    BALANCE_SUPPLIER_FIAL_GOBACK     => ['name' => '维权倒扣佣金','serv_type' => 0,  'commission_details'=>1],
];


// 结算方式
const SETTLE_TYPE_PROFIT = 1;   // 返佣
const SETTLE_TYPE_PREPAY = 2;   // 预充
const SETTLE_TYPE_ALL_RECHARGE = 3;   // 批量充值

const SETTLE_TYPE_AGENT_SELF = 10;   // 代理商自配置秘钥的订单
const SETTLE_TYPE_OTHER_ORTHER = 11;   // 其他表自己结算了，不需要结算了

// 订单来源
const ORDER_FROM_H5 = 1;    // H5
const ORDER_FROM_API = 2;   // api
const ORDER_FROM_BATCH_IMPORT = 3; // 代理商批量导入

const SLOW_RECHARGE = 1; // 慢充
const FAST_RECHARGE = 2; // 快充

// 状态码
const CODE_SUCCESS = 200;   // 成功
const CODE_ERROR = 0;   // 其他错误
const CODE_MISS_PARAM = 1001;   // 缺少参数
const CODE_ACCOUNT_NOT_FOUND = 1002;    // 账号不存在
const CODE_MISS_PERMISSION = 1003;  // 没有接口调用权限
const CODE_ACCOUNT_FORBIDDEN = 1004;    // 账号被禁用
const CODE_SIGN_ERROR = 1005;   // 签名错误
const CODE_TIMESTAMP_TIMEOUT = 1006;    // 请求过期，timestamp 与系统服务器误差不超过 180 秒
const CODE_MOBILE_ERROR = 1007; // 手机号码格式有误
const CODE_MOBILE_AMOUNT_ERROR = 1008;  // 充值金额有误
const CODE_LACK_OF_BALANCE = 1009;  // 账号余额不足
const CODE_GENERATE_ORDER_FAIL = 1010;  // 订单号生成失败
const CODE_ORDER_EXISTS = 1011; // 订单已存在
const CODE_IP_ERROR = 1012; // IP不在白名单
const CODE_ORDER_NOT_EXISTS = 1013; // 订单不存在
const CODE_SYSTEM_ERROR = 1999; // 系统繁忙

const AGENT_USER_PLATFORM = 1; // dmj_platform_user->platform取值 ，此时的 app_id 是 代理商id (不能表关联，字段类型不一样)
const OIL_SUPPLIER_ALIAS = [
    'xiaoju' => ['alias' => 'xiaoju'],
];

const PRODUCT_MOBILE_SERV = 1;
const PRODUCT_OIL_SERV = 2;
const PRODUCT_COUPON_SERV = 3;
const PRODUCT_MEAL_SERV = 4;
const PRODUCT_FILM_SERV = 5;
const PRODUCT_METUAN_SERV = 6;//美团到店
const PRODUCT_OILCARD_SERV = 7;
const PRODUCT_POWER_SERV = 8;
const PRODUCT_TRAVEL_OIL_SERV = 9;
const PRODUCT_AROUND_SHOP_SERV = 10;
const PRODUCT_FOOD_SHOP_SERV = 11;
const PRODUCT_SECKILL_SERV = 12;//美团秒杀
const PRODUCT_ELE_SERV = 13;//饿了么外卖
const PRODUCT_MEITUAN_TAKEOUT_SERV = 14;//美团外卖
const PRODUCT_MOBILE_CPS_SERV = 15;  //京东联盟京喜话费

const PRODUCT_SERV_TYPE = [
    PRODUCT_MOBILE_SERV => ['name' => '话费', 'orderName' => '话费订单'],
    PRODUCT_OIL_SERV => ['name' => '滴滴加油', 'orderName' => '加油订单'],
    PRODUCT_COUPON_SERV => ['name' => '权益', 'orderName' => '权益订单'],
//    PRODUCT_MEAL_SERV => ['name' => '外卖', 'orderName' => '外卖订单'],
    PRODUCT_FILM_SERV => ['name' => '电影票', 'orderName' => '影票订单'],
    PRODUCT_METUAN_SERV => ['name' => '到店', 'orderName' => '到店订单'],
    PRODUCT_SECKILL_SERV => ['name' => '美团附近秒杀', 'shortName' =>'秒杀','orderName' => '秒杀订单'],
    PRODUCT_OILCARD_SERV => ['name' => '油卡', 'orderName' => '油卡订单'],
    PRODUCT_POWER_SERV => ['name' => '电费', 'orderName' => '电费订单'],
    PRODUCT_TRAVEL_OIL_SERV => ['name' => '出行/加油', 'orderName' => '出行/加油订单'],
    PRODUCT_AROUND_SHOP_SERV => ['name' => '周边游', 'orderName' => '周边游订单'],
    PRODUCT_FOOD_SHOP_SERV => ['name' => '连锁餐饮', 'orderName' => '连锁餐饮订单'],
    PRODUCT_ELE_SERV => ['name' => '饿了么外卖', 'orderName' => '饿了么外卖订单'],
    PRODUCT_MEITUAN_TAKEOUT_SERV => ['name' => '美团外卖', 'orderName' => '美团外卖订单'],
    PRODUCT_MOBILE_CPS_SERV => ['name' => 'CPS话费', 'orderName' => 'CPS话费'],

];  // 提供给代理商的服务类型
const TAKEOUT_ORDER_MEITUAN = 1;    // 美团订单
const TAKEOUT_ORDER_ELE = 2;    // 饿了么订单
const TAKEOUT_ORDER_MEITUAN_PUB = 3;    // 美团到店订单

const WAIT_PAY_TIME = 30;    // 待付款倒计时  单位分钟


// CPS订单相关模块
const CPS_SERVICE_TYPE = [
    PRODUCT_COUPON_SERV => '权益',
    PRODUCT_TRAVEL_OIL_SERV => '出行/加油',
    PRODUCT_AROUND_SHOP_SERV => '周边游',
    PRODUCT_FOOD_SHOP_SERV => '连锁餐饮',
    PRODUCT_SECKILL_SERV => '美团秒杀',
    PRODUCT_MEITUAN_TAKEOUT_SERV => '美团外卖',
    PRODUCT_ELE_SERV => '饿了么外卖',
    PRODUCT_METUAN_SERV => '到店',
    PRODUCT_MOBILE_CPS_SERV => 'CPS话费',
];


// 第一位 1慢充 2快充
// 第二问 1移动 2联通 3电信
const YIDONG_SLOW   = 11; // 移动慢充
const LIANTONG_SLOW = 12; // 联通慢充
const DIANXIN_SLOW  = 13; // 电信慢充
const YIDONG_FAST   = 21; // 移动快充
const LIANTONG_FAST = 22; // 联通快充
const DIANXIN_FAST  = 23; // 电信快充

// 删除方式
const DELETE_TYPE_YES = 1;  // 删除
const DELETE_TYPE_NO = 0;  // 未删除
// 平台属性
const PLATFORM_ADMIN = 'admin';  // 总后台
const PLATFORM_AGENT = 'agent';  // 代理商

//THINKPHP应用
const FROM_APP_YMSH = 'ymsh';//有美生活
const FROM_APP_ADMIN = 'admin';//后台
const FROM_APP_AGENT = 'agent';//代理后台
const FROM_APP_API = 'api';//代理后台
const FROM_OPEN_PLATFORM_API = 'open_platform';//开放平台(对外的)


//正式环境临时方案，只有指定代理id的才返佣
const TAKEOUT_IDS = [390,388,387,386];
